package com.socialuni.sdk.service;

import com.socialuni.sdk.model.DO.user.UserDO;
import com.socialuni.sdk.manage.CommonUserAccountDOCreate;
import com.socialuni.sdk.utils.UserUtils;
import com.socialuni.sdk.utils.SocialUniProviderUtil;
import com.socialuni.sdk.model.ProviderLoginQO;
import com.socialuni.sdk.model.UniUnionIdRO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class SocialUserBindAccountService {
    @Resource
    CommonUserAccountDOCreate commonUserAccountDOCreate;

    public void bindProviderAccount(ProviderLoginQO loginQO) {
        UniUnionIdRO uniUnionIdRO = SocialUniProviderUtil.getUnionIdRO(loginQO);
        UserDO userDO = UserUtils.getMineUser();
        commonUserAccountDOCreate.create(userDO, loginQO, uniUnionIdRO);
    }
}